package com.baoteng.captcha.recognition.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.method.annotation.AbstractJsonpResponseBodyAdvice;

import com.baoteng.captcha.recognition.vo.BaseVO;

@ControllerAdvice(basePackages = {"com.baoteng.captcha.recognition.controller"})
public class CommController extends AbstractJsonpResponseBodyAdvice{

	public CommController() {  
        super("cp","jsonp");  
    }
	
	@ResponseBody
	@ExceptionHandler(value = Exception.class)
	public BaseVO errorHandler(Exception ex) {
		BaseVO vo = new BaseVO("500", ex.getMessage());
		return vo;
	}
	
	
}
